home *** CD-ROM | disk | FTP | other *** search
- Path: robertk.accessone.com!user
- From: robertk@accessone.com (robertk)
- Newsgroups: comp.lang.c
- Subject: very simple newbie question
- Date: 28 Feb 1996 07:13:20 GMT
- Organization: Kingdom
- Message-ID: <robertk-2802960012350001@robertk.accessone.com>
- NNTP-Posting-Host: robertk.accessone.com
-
- how come.....
-
- #include <stdio.h>
- main()
- {
- char s[10];
- scanf("%s",s);
- printf("%s",s);
- }
-
- when i run this and input:
-
- robert <enter> --->soon as i hit the enter key i am
- thrown back to the ide-upon returning to
- the screen i see
- robert
- robert
-
- BUT...........
-
- #include <stdio.h>
- main()
- {
- char s[10];
- scanf("%s/n",s);
- printf("%s",s);
- }
-
- when i run this and input:
-
- robert <enter> --->when i hit the enter key the cursor
- drops down a line and sits ther flashing
- waiting for me to enter another character
- like x before it will throw me back to the
- ide. upon returning to the screen i see
- robert
- x
- robert
-
- i thought scanf() ignored whitespace?
-